package com.class05.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;

/**
 * @ClassDescription:
 * 控制层的配置类
 *  (controller,springmvc)
 *  1.controller
 *  2.全局异常处理器
 *  3.handlerMapping  handlerAdapter
 *  4.静态资源处理
 *  5.jsp 视图解析器前后缀
 *  6.json转化器
 *  7.拦截器。。。。
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2023/12/20 16:54
 */
@EnableWebMvc
@Configuration
@ComponentScan({"com.class05.controller","com.class05.exceptionhandler"})
public class WebMvcJavaConfig implements WebMvcConfigurer {
    @Override//开启允许对静态资源进行访问
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }

    @Override//处理jsp 视图解析器前后缀
    public void configureViewResolvers(ViewResolverRegistry registry) {
        registry.jsp("/WEN-INF/views/",".jsp");
    }

    @Override//添加拦截器
    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new xxx()).addPathPatterns().excludePathPatterns();
    }
}
